import Vue from 'vue'

//1. 引入路由包
import VueRouter from 'vue-router'

//2. 安装插件包到Vue上, 
Vue.use(VueRouter);

let router = new VueRouter({
  mode:'history'
});

import home from '../pages/home.vue'
import follow from '../pages/follow.vue'
import column from '../pages/column.vue'
import detail from '../pages/detail.vue'
import login from '../pages/login.vue'
import user from '../pages/user.vue'
import reg from '../pages/reg.vue'
import NoPage from '../pages/no-page.vue'


//异步读取配置，添加到实例
router.addRoutes([
  {path:'/home',component:home,meta:'首页'},
  {path:'/follow',component:follow,meta:'关注'},
  {path:'/column',component:column,meta:'栏目'},
  {path:'/detail/:_id',component:detail,meta:'详情'},
  {path:'/user',component:user,meta:'我的'},
  {path:'/login',component:login,meta:'登录'},
  {path:'/reg',component:reg,meta:'注册'},
  {path:'/',redirect:'/home'},
  {path:'*',component:NoPage,meta:'该也找不到'},
])


export default router
